# main.py
import time
from threading import Thread
from display_handler import DisplayHandler
from camera_handler import CameraHandler
from predictor import Predictor
from flask1.app import Web
import config as cfg
#from control import FullDetect

web = Web()
#fd = FullDetect()

if __name__ == '__main__':
    label_time = 0

    t1 = Thread(target=web.Run)
    t1.start()

#    fd = FullDetect()
#    fd.Start()

#    t2 = Thread(target=fd.RecData)
#    t2.start()

    model_path = cfg.model_path
    start_time = time.time()
    p = Predictor(model_path)
    j = 0

    camera_handler = CameraHandler()
    display_handler = DisplayHandler()

    while True:
        frame = camera_handler.capture_frame()
       #camera_handler.show_frame(frame)

        display_handler.show_with_model(p, frame, start_time, j, label_time)
        time.sleep(1)
